<?php
/**
 * 热门展会
 * User: jh
 * Date: 2018/3/23
 * Time: 18:23
 */
namespace frontend\widgets;
use common\models\Exhibition;
use yii\bootstrap\Widget;

class Hotexhibition extends Widget {

    private $view = '@frontend/views/widget/hotexhibition.php';

    public $params = [];

    public function init()
    {

        $hot = Exhibition::find()->select('id,title,logo,address,city,litpic')->where(['status'=>1,'is_deleted'=>0])
            ->orderBy('hot desc,audience_number desc,id desc')
            ->limit(4)
            ->asArray()
            ->all();
        $this->params['hot'] = $hot;
    }

    public function run()
    {
        echo $this->renderFile($this->view, $this->params);
    }
}